import { customRef } from 'vue'


export default function usegeyao(initialValue,dalay) {
    
    var timer = null
    var msg = customRef((track, trigger)=>{
        return {
            get(){
                track()
                return initialValue
                console.log('get')
            },
            set(val){
                clearTimeout(timer)
                timer = setTimeout(()=>{
                    initialValue = val
                    trigger()
                },dalay)
                
                
              console.log('set')
            }
        }
    }
    )
    return {msg}
}
